From: Florian Müllner Date: Wed, 5 Jan 2022 02:18:08 +0000 (+0100) Subject: dateMenu: Port to GWeather 4.0 X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~536^2^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ab52ce4591839e2c6883c6034dfdfe73b2e630be;p=gnome-shell.git dateMenu: Port to GWeather 4.0 Besides dropping its GTK dependency (which doesn't affect us), GWeather 4.0 replaces its own timezone type with GTimeZone. It's easy enough to adjust to that, so port over to the new version. Part-of: --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b40419662..32eade155 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,7 @@ variables: LINT_LOG: "eslint-report.xml" LINT_MR_LOG: "eslint-mr-report.xml" -image: registry.gitlab.gnome.org/gnome/mutter/fedora/34:x86_64-2021-09-15.0 +image: registry.gitlab.gnome.org/gnome/mutter/fedora/35:x86_64-2022-01-05.0 workflow: rules: diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 6edd790a0..89289179b 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -339,9 +339,13 @@ class WorldClocksSection extends St.Button { this._locations.push({ location: l }); } + const unixtime = GLib.DateTime.new_now_local().to_unix(); this._locations.sort((a, b) => { - return a.location.get_timezone().get_offset() - - b.location.get_timezone().get_offset(); + const tzA = a.location.get_timezone(); + const tzB = b.location.get_timezone(); + const intA = tzA.find_interval(GLib.TimeType.STANDARD, unixtime); + const intB = tzA.find_interval(GLib.TimeType.STANDARD, unixtime); + return tzA.get_offset(intA) - tzB.get_offset(intB); }); let layout = this._grid.layout_manager; @@ -412,8 +416,9 @@ class WorldClocksSection extends St.Button { } _getTimezoneOffsetAtLocation(location) { + const tz = location.get_timezone(); const localOffset = GLib.DateTime.new_now_local().get_utc_offset(); - const utcOffset = this._getTimeAtLocation(location).get_utc_offset(); + const utcOffset = GLib.DateTime.new_now(tz).get_utc_offset(); const offsetCurrentTz = utcOffset - localOffset; const offsetHours = Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR; const offsetMinutes = @@ -427,15 +432,10 @@ class WorldClocksSection extends St.Button { return text; } - _getTimeAtLocation(location) { - let tz = GLib.TimeZone.new(location.get_timezone().get_tzid()); - return GLib.DateTime.new_now(tz); - } - _updateTimeLabels() { for (let i = 0; i < this._locations.length; i++) { let l = this._locations[i]; - let now = this._getTimeAtLocation(l.location); + const now = GLib.DateTime.new_now(l.location.get_timezone()); l.timeLabel.text = Util.formatTime(now, { timeOnly: true }); } } diff --git a/js/ui/environment.js b/js/ui/environment.js index ad2b8e4f2..67571152a 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -9,7 +9,7 @@ imports.gi.versions.GdkPixbuf = '2.0'; imports.gi.versions.GnomeBluetooth = '1.0'; imports.gi.versions.GnomeDesktop = '3.0'; imports.gi.versions.Gtk = '3.0'; -imports.gi.versions.GWeather = '3.0'; +imports.gi.versions.GWeather = '4.0'; imports.gi.versions.Soup = '3.0'; imports.gi.versions.TelepathyGLib = '0.12'; imports.gi.versions.TelepathyLogger = '0.2';